package com.tpu.actionclasses;

import java.util.Date;

import org.apache.tapestry.*;
import org.apache.tapestry.annotations.*;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.form.*;
import org.apache.tapestry.html.BasePage;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.tpu.daoclasses.SessionOwner;

public abstract class Afishan extends BasePage {
	@InjectPage("AfishaPlacen")
	@InjectObject("service:com.tpu.daoclasses.SessionOwner")
	public abstract SessionOwner getSessionOwner();
	abstract public AfishaPlacen getAfishaPlacePage();
	abstract public String getShowPlaceid();
	abstract public Date getQuoteDate();
	public void pageBeginRender(PageEvent event) {
		Session session = getSessionOwner().getSession();
		Transaction tx = session.beginTransaction();
		try {
		Query query = session.createQuery("select c from Customer as c");
		//customerList = query.list();
		tx.commit();
		} catch (RuntimeException e) {	

		}
	}
	public IPage onOk(IRequestCycle cycle) {
	AfishaPlacen afishaplacePage = getAfishaPlacePage();
	afishaplacePage.setShowPlaceid(getShowPlaceid());
	return afishaplacePage;
	}
	public IPropertySelectionModel getAvailPlaces() {
	return new StringPropertySelectionModel(new String[] { "IBM", "MSFT",
	"RHAT" });
	}
	
}
